#include "remove_json_comment.h"

#include<regex>
#include<iostream>
#include <fstream>
#include <sstream>

using namespace std;
string pattern_str("(<!--.*-->)");
regex pattern_regex(pattern_str, regex::icase);

std::string removeCommentOfJsonString(std::string & jsonString)
{
    smatch result;
    if(regex_match(jsonString, result, pattern_regex))
    {
        for(int i=0,count=result.size();i<count;++i)
        {
            cout << result[i]<<endl;
        }
    }
    return string();
}

string readContentFromFile(const char *fileName)
{
    ifstream file(fileName);
    ostringstream buf;
    char ch;
    while(buf && file.get(ch))
    {
        buf.put(ch);
    }

    return buf.str();
}
